﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
    public class DbHelper
    {
        private static readonly string conString = "server=.\\SQLEXPRESS;database=Blogs;uid=sa;pwd=233333";
        private static int n;
        private static object con;
        private object textBox1;
        private object textBox2;

        public static object TextBox1 { get; private set; }

        public static DataTable GetDataTable(string sql)
        {
            SqlConnection connection = new SqlConnection(conString);

            SqlDataAdapter adapter = new SqlDataAdapter(sql, connection);

            DataTable dt = new DataTable();

            connection.Open();
            adapter.Fill(dt);
            return dt;

            if(n != 0)
            {
                MessageBox.Show("登录成功！", "提示");
                this.Hide();
                Form1 form1 = new Form1();
                form1.ShowDialog();
            }
            else
            {
                MessageBox.Show("用户名或密码错误，请重新输入！","提示");
            }
            


           
        }

        
        
       
    }
    
       
      
        










    
}
